from ronglian_sms_sdk import SmsSDK
from celery import Celery

accId = '8aaf070881ad8ad401821a33b54c1b39'
accToken = '14fe61527f4a4bacade13e6e8acebebb'
appId = '8aaf070881ad8ad401821a33b61c1b40'


def send_sms_code(mobile,data):
    sdk = SmsSDK(accId, accToken, appId)
    tid = '1'  # 容联云分配的一个测试短信验证码模版

    datas = (data,)  #元组
    resp = sdk.sendMessage(tid, mobile, datas)
    return resp
    # print(resp)
    # res_json = json.loads(resp)
    # print(res_json.get('statusCode'))
    # if res_json.get('statusCode') == '000000':
    #     return True
    # else:
    #     return False



celery=Celery('my_celery',broker='redis://root@localhost:6379/2')
@celery.task
def send_sms_code_test():
    print('测试任务')